<template>
  <div>
    <p>欢迎光临vue开发的圈钱水果店</p>
   <table>
    <tr><h3>苹果10￥/斤，折扣&lt;8折&gt;</h3></tr>
    <tr>请输入你要买的斤数:{{weight}} <input type="text" v-model="weight"> </tr>
    <tr><button @click="sumMoney">结账买单~</button></tr>
    <tr>结账单:总价:{{sum}}￥元，折后价:{{discount}}￥元省了:{{save}}￥元</tr>
  </table>
  </div>
</template>

<script>
// 思路：斤数：weight:获取表单的value值

// 总价sum：10*this.weight
// 折后价：sum*0.8
// 节省的钱：save:sumy-discount

export default {
    data() {
      return{
        weight:'',
        sum:'',
        discount:'',
        save:''
      }
     
    },
     methods:{
       sumMoney() {
         this.sum = this.weight*10
         this.discount = this.sum*0.8
          this.save=this.sum-this.discount
       }
     }
}
</script>

<style lang="scss" scoped>

</style>